#ifndef DW_GRAPHICS_LIGHT_H
#	define DW_GRAPHICS_LIGHT_H

# include "object.h"
#	include "color.h"

namespace dw
{
namespace graphics
{
using maths::Point4f;
using maths::Vector4f;

class Light : public Object
{
public:

	enum LightType { POINT, SPOT, DIRECTIONAL };

public:

	//Light();

	Light(const LightType& = DIRECTIONAL, 
		const Point4f& = Point4f(0, 0, 0, 1), 
		const Vector4f& = Vector4f(0, 0, 1, 0),
		const Colorf& = Colorf(1.f, 1.f, 1.f, 1.f));



	virtual Type getType() const ;



	void setLightType(const LightType lightType) { _lightType = lightType; }

	void setCastShadows(const bool castShadows) { _castShadows = castShadows; }

	void setAmbient(const Colorf& color) { _ambient = color; }

	void setDiffuse(const Colorf& color) { _diffuse = color; }

	void setSpecular(const Colorf& color) { _specular = color; }

	void setPosition(const Point4f& position) { _position = position; }

	void setDirection(const Vector4f direction) { _direction = direction; }



	bool getCastShadows() const { return _castShadows; }

	const LightType getLightType() const { return _lightType; }

	const Point4f& getPosition() const	{ return _position; }
	
	const Vector4f& getDirection() const	{ return _direction; }
	
	const Colorf& getAmbient() const	{ return _ambient; }
	
	const Colorf& getDiffuse() const	{ return _diffuse; }
	
	const Colorf& getSpecular() const	{ return _specular; }
	

	virtual bool intersects(const Ray& ray)	const { return false; }

	virtual void render() const ;
	
protected:

	LightType _lightType;
	
	Point4f _position;
	
	Vector4f _direction;
	
	Colorf _ambient, _diffuse, _specular;

	bool _castShadows;

	float _range;

private:
	
	friend	
	std::ostream& operator<<(std::ostream&, const Light&);
	
	friend	
	std::istream& operator>>(std::istream&, Light&);
};

} // namespace graphics
} // namespace dw

#endif // !DW_GRAPHICS_LIGHT_H
